#ifndef __COUNTER_HPP__
#define __COUNTER_HPP__

#include <atomic>

#include "metrics/ClientMetric.hpp"
#include "metrics/MetricType.hpp"

namespace metrics
{
    class Counter
    {
    private:
        std::atomic<double> _value{0};

    public:
        static const MetricType METRIC_TYPE{MetricType::Counter};

        Counter(double v = 0);
        ~Counter();

        void increment(double v = 1);
        double value() const;
        ClientMetric collect() const;

    private:
        void change(double);
    };
    
} // namespace metrics

#endif // __COUNTER_HPP__